import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        int[]num={0,1,2,3,4,5,6,7,9};
        int a=num.length+1;
        int[]numb=new int[a];
        for (int i = 0; i <a; i++) {
            numb[i]=i;
        }
        Arrays.sort(num);
        for(int j=0;j<num.length;j++){
            if(num[j]!=numb[j]){
                System.out.println(j);
                return;
            }
        }
        System.out.println(num.length);
    }
}